package org.turl.utils;

import java.lang.reflect.Constructor;

/**
 * Created by tonyx
 * User: tonyx
 * Date: May 22, 2008
 * Time: 6:38:44 PM
 */
public class ConstructorPairAndContractClass {
    Constructor origin;
    Constructor target;
    Class contractClass;
    public ConstructorPairAndContractClass(Constructor origin, Constructor target,Class contractClass) {
        this.origin=origin;
        this.target=target;
        this.contractClass=contractClass;
    }

    public Constructor getOrigin() {
        return origin;
    }

    public Constructor getTarget() {
        return target;
    }

    public Constructor getContractClss() {
        return target;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ConstructorPairAndContractClass that = (ConstructorPairAndContractClass) o;

        if (contractClass != null ? !contractClass.equals(that.contractClass) : that.contractClass != null)
            return false;
        if (origin != null ? !origin.equals(that.origin) : that.origin != null) return false;
        if (target != null ? !target.equals(that.target) : that.target != null) return false;

        return true;
    }

    public int hashCode() {
        int result;
        result = (origin != null ? origin.hashCode() : 0);
        result = 31 * result + (target != null ? target.hashCode() : 0);
        result = 31 * result + (contractClass != null ? contractClass.hashCode() : 0);
        return result;
    }
}
